<div class="container">
    <h1>Add Item</h1>
    
    <form>
        <fieldset>
            <legend>New Item</legend>
            <p>
                <label>Category</label>
                <select id="category" name="category_id">

                </select>
            </p>
            <p>
                <label>Name:</label>
                <input type="text" name="name" />
            </p>
            
            <p>
                <label>price:</label>
                <input type="number" name="price" />
            </p>
            
            <p>
                <label>overview:</label>
                <textarea name="overview"></textarea>
            </p>
            
            <p>
                <input type="submit"/>
            </p>
        </fieldset>
    </form>
</div>

<script>
    $(document).ready(function() {
        var category = <?php echo $this->categories?>;
        var str = "";
        
        for ( var i = 0; i < category.length; i++)
            str += '<option value="'+category[i].id+'">'+category[i].name+'</option>';
       
        $('#category').append(str);
    });

    $('select').on('change', function() {
        alert( this.value ); // or $(this).val()
        
    });
</script>